﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DeJC.BLL.Managers;
using DeJC.DAL.Model;

namespace TheList.Helper {
    public class Utility {

        public static User GetCurrentUser()
        {
            User user = UserManager.GetByUserName(HttpContext.Current.User.Identity.Name);
            if(user!=null) {
                return user;
            }
            return null;
        }
        public static int GetCurrentUserId
        {
            get
            {
                int cuId=GetCurrentUser()!=null?GetCurrentUser().ID:0;
                return cuId;                
            }

        }

        #region ParentTypes
        public static int ParentLanguageId
        {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pLangaugeId"]); }
        }
        public static int ParentRolId {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pRolId"]); }
        }
        public static int ParentCategoryId {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pCategoryId"]); }
        }
        public static int ParentContactTypeId {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pContactTypeId"]); }
        }
        public static int ParentAddressTypeId {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pAddressTypeId"]); }
        }
        public static int ParentProductUnitId {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pProductUnit"]); }
        }
        public static int ParentProductBrandId {
            get { return int.Parse(System.Configuration.ConfigurationManager.AppSettings["pProductBrand"]); }
        }

        #endregion
    }
}